package com.sophialex.health.record.common.bind.swt.convertors;

import java.util.Date;

import org.apache.commons.httpclient.util.DateUtil;
import org.eclipse.core.databinding.UpdateValueStrategy;

/**
 *@author sunxq
 *用于将SWT DateTime控件的值传换为符合类似于"1984-3-4"这种格式的文本
 */
public class DateUIToModelConvertor extends UpdateValueStrategy {
	public static final String name = "com.sophialex.health.record.common.bind.swt.convertors.DateUIToModelConvertor";
	private static final String DATE_TYPE_SIMPLE = "yyyy-DD-mm";
	public Object convert(Object value) {
		Date d = (Date)value;
		return DateUtil.formatDate(d, DATE_TYPE_SIMPLE);
	}
}
